/*
 * morse.h
 * Convert ascii to morse code
 * by J. Stuart McMurray
 * Created 20120511
 * Last Modified 20120511
 */

#ifndef HAVE_MORSE_H
#define HAVE_MORSE_H

struct morse_table_entry {
    char ascii;
    int nel;
    char *morse;
};

///* 1 represents a dot.  3 represents a dash. */
static struct morse_table_entry morse_table[] = {
    { 0x00,  0, NULL },
    { 0x01,  0, NULL },
    { 0x02,  0, NULL },
    { 0x03,  0, NULL },
    { 0x04,  0, NULL },
    { 0x05,  0, NULL },
    { 0x06,  0, NULL },
    { 0x07,  0, NULL },
    { 0x08,  0, NULL },
    { 0x09,  0, NULL },
    { 0x0A,  0, NULL },
    { 0x0B,  0, NULL },
    { 0x0C,  0, NULL },
    { 0x0D,  0, NULL },
    { 0x0E,  0, NULL },
    { 0x0F,  0, NULL },
    { 0x10,  0, NULL },
    { 0x11,  0, NULL },
    { 0x12,  0, NULL },
    { 0x13,  0, NULL },
    { 0x14,  0, NULL },
    { 0x15,  0, NULL },
    { 0x16,  0, NULL },
    { 0x17,  0, NULL },
    { 0x18,  0, NULL },
    { 0x19,  0, NULL },
    { 0x1A,  0, NULL },
    { 0x1B,  0, NULL },
    { 0x1C,  0, NULL },
    { 0x1D,  0, NULL },
    { 0x1E,  0, NULL },
    { 0x1F,  0, NULL },
    { ' ',   7, NULL },
    { '!',   0, NULL },
    { '"',   0, NULL },
    { '#',   0, NULL },
    { '$',   0, NULL },
    { '%',   0, NULL },
    { '&',   0, NULL },
    { '\'',  0, NULL },
    { '(',   0, NULL },
    { ')',   0, NULL },
    { '*',   0, NULL },
    { '+',   0, NULL },
    { ',',   0, NULL },
    { '-',   0, NULL },
    { '.',   0, NULL },
    { '/',   0, NULL },
    { '0',  19, "33333" },
    { '1',  17, "13333" },
    { '2',  15, "11333" },
    { '3',  13, "11133" },
    { '4',  11, "11113" },
    { '5',   9, "11111" },
    { '6',  11, "31111" },
    { '7',  13, "33111" },
    { '8',  15, "33311" },
    { '9',  17, "33331" },
    { ':',   0, NULL },
    { ';',   0, NULL },
    { '<',   0, NULL },
    { '=',   0, NULL },
    { '>',   0, NULL },
    { '?',   0, NULL },
    { '@',   0, NULL },
    { 'A',   5, "13" },
    { 'B',   9, "3111" },
    { 'C',  11, "3131" },
    { 'D',   7, "311" },
    { 'E',   1, "1" },
    { 'F',   9, "1131" },
    { 'G',   9, "331" },
    { 'H',   7, "1111" },
    { 'I',   3, "11" },
    { 'J',  13, "1333" },
    { 'K',   9, "313" },
    { 'L',   9, "1311" },
    { 'M',   7, "33" },
    { 'N',   5, "31" },
    { 'O',  11, "333" },
    { 'P',  11, "1331" },
    { 'Q',  13, "3313" },
    { 'R',   7, "131" },
    { 'S',   5, "111" },
    { 'T',   3, "3" },
    { 'U',   7, "113" },
    { 'V',   9, "1113" },
    { 'W',   9, "133" },
    { 'X',  11, "3113" },
    { 'Y',  13, "3133" },
    { 'Z',  11, "3311" },
    { '[',   0, NULL },
    { '\\',  0, NULL },
    { ']',   0, NULL },
    { '^',   0, NULL },
    { '_',   0, NULL },
    { '`',   0, NULL },
    { 'a',   5, "13" },
    { 'b',   9, "3111" },
    { 'c',  11, "3131" },
    { 'd',   7, "311" },
    { 'e',   1, "1" },
    { 'f',   9, "1131" },
    { 'g',   9, "331" },
    { 'h',   7, "1111" },
    { 'i',   3, "11" },
    { 'j',  13, "1333" },
    { 'k',   9, "313" },
    { 'l',   9, "1311" },
    { 'm',   7, "33" },
    { 'n',   5, "31" },
    { 'o',  11, "333" },
    { 'p',  11, "1331" },
    { 'q',  13, "3313" },
    { 'r',   7, "131" },
    { 's',   5, "111" },
    { 't',   3, "3" },
    { 'u',   7, "113" },
    { 'v',   9, "1113" },
    { 'w',   9, "133" },
    { 'x',  11, "3113" },
    { 'y',  13, "3133" },
    { 'z',  11, "3311" },
    { '{',   0, NULL },
    { '|',   0, NULL },
    { '}',   0, NULL },
    { '~',   0, NULL },
    { 0x7F,  0, NULL },
};

#endif